package com.shockweb.common.calculate.function;

import java.math.BigDecimal;

import com.shockweb.common.calculate.CalculateException;
import com.shockweb.common.calculate.api.IFunction;

import java.util.List;

/**
 * 随即数根表达式
 * @author pengminghua
 *
 */
public class Random implements IFunction{

	/**
	 * @see IFunction#eval(List)
	 */
	public BigDecimal eval(List<Object> params) throws CalculateException {
		try{
			return new BigDecimal(Math.random());
		}catch(Exception e){
			throw new CalculateException(e);
		}
	}

	/**
	 * @see IFunction#getParamCount()
	 */
	public int getParamCount() {
		return 0;
	}
	
	/**
	 * @see IFunction#getName()
	 */
	public String getName() {
		return "random";
	}
}
